package edu.gatech.TNE.wonderLab7000.util;

public class Encrypt {
	public Encrypt()
	{
		
	}
	
	public String encrypt(String str)
	{
		String out = "";
		char[] chars = str.toCharArray();
		for(int i = 0; i<chars.length; i++)
		{
			if(i%2 == 0)
				chars[i] = (char)(((int)chars[i]) + 7);
			else
				chars[i] = (char)(((int)chars[i]) + 31);
			out = out + Character.toString(chars[i]);
		}
		return out;
	}
	
	public String decrypt(String str)
	{
		String out = "";
		char[] chars = str.toCharArray();
		for(int i = 0; i<chars.length; i++)
		{
			if(i%2 == 0)
				chars[i] = (char)(((int)chars[i]) - 7);
			else
				chars[i] = (char)(((int)chars[i]) - 31);
			out = out + Character.toString(chars[i]);
		}
		return out;
	}
	public static void main(String[] args)
	{
		Encrypt crypter = new Encrypt();
		String h = crypter.encrypt("Matthew Dye");
		System.out.println(h);
		System.out.println(crypter.decrypt(h));
	}

}
